home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / elv18src.zip / prsvdos.c < prev    next >
C/C++ Source or Header  |  1993-10-15  |  2KB  |  59 lines

  1. /* prsvdos.c */
  2.  
  3. /* This file contains the DOS-specific parts of the "elvprsv" program. */
  4.  
  5. #include <stdio.h>
  6.  
  7. /* This function returns the login name of the owner of a file */
  8. char *ownername(filename)
  9.     char    *filename;    /* name of a file */
  10. {
  11.     return "user";
  12. }
  13.  
  14.  
  15. /* This function sends a mail message to a given user, saying that a file
  16.  * has been preserved.
  17.  */
  18. void mail(user, file, when, tmp)
  19.     char    *user;    /* name of user who should receive the mail */
  20.     char    *file;    /* name of original text file that was preserved */
  21.     char    *when;    /* description of why the file was preserved */
  22.     int    tmp;    /* NULL normally; else name of temp file if user should run elvprsv -R */
  23. {
  24.     char    cmd[80];/* buffer used for constructing a "mail" command */
  25.     FILE    *m;    /* stream used for giving text to the "mail" program */
  26.     char    *base;    /* basename of the file */
  27.  
  28.     /* separate the directory name from the basename. */
  29.     for (base = file + strlen(file); --base > file && *base != SLASH; )
  30.     {
  31.     }
  32.     if (*base == SLASH)
  33.     {
  34.         *base++ = '\0';
  35.     }
  36.  
  37.     /* for anonymous buffers, pretend the name was "foo" */
  38.     if (!strcmp(base, "*"))
  39.     {
  40.         base = "foo";
  41.     }
  42.  
  43.     /* Tell the user that the file was preserved */
  44.     printf("A version of your file \"%s%c%s\"\n", file, SLASH, base);
  45.     printf("was preserved when %s.\n", when);
  46.     printf("To recover this file, do the following:\n");
  47.     printf("\n");
  48.     printf("     C:\\> cd %s\n", file);
  49.     if (tmp)
  50.     {
  51.         printf("     %s> elvprsv -R %s\n", file, tmp);
  52.     }
  53.     else
  54.     {
  55.         printf("     %s> elvrec %s\n", file, base);
  56.     }
  57.     printf("\n");
  58. }
  59.